/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package escr.persistencia;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author Aditardo
 */
@Entity
@Table(name = "datospobla_pregunta")
@NamedQueries({@NamedQuery(name = "DatospoblaPregunta.findByDpbCod", query = "SELECT d FROM DatospoblaPregunta d WHERE d.dpbCod = :dpbCod")})
public class DatospoblaPregunta implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Column(name = "DPB_COD", nullable = false)
    private Integer dpbCod;
    @Lob
    @Column(name = "DPB_NOMBRE")
    private String dpbNombre;
    @JoinColumn(name = "TPB_COD", referencedColumnName = "TPB_COD")
    @ManyToOne
    private TipoPoblacion tpbCod;

    public DatospoblaPregunta() {
    }

    public DatospoblaPregunta(Integer dpbCod) {
        this.dpbCod = dpbCod;
    }

    public Integer getDpbCod() {
        return dpbCod;
    }

    public void setDpbCod(Integer dpbCod) {
        this.dpbCod = dpbCod;
    }

    public String getDpbNombre() {
        return dpbNombre;
    }

    public void setDpbNombre(String dpbNombre) {
        this.dpbNombre = dpbNombre;
    }

    public TipoPoblacion getTpbCod() {
        return tpbCod;
    }

    public void setTpbCod(TipoPoblacion tpbCod) {
        this.tpbCod = tpbCod;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (dpbCod != null ? dpbCod.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof DatospoblaPregunta)) {
            return false;
        }
        DatospoblaPregunta other = (DatospoblaPregunta) object;
        if ((this.dpbCod == null && other.dpbCod != null) || (this.dpbCod != null && !this.dpbCod.equals(other.dpbCod))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "escr.persistencia.DatospoblaPregunta[dpbCod=" + dpbCod + "]";
    }

}
